package ar.edu.utn.frgp.TPFinalBanco.action;

import ar.edu.utn.frgp.TPFinalBanco.model.Cliente;
import ar.edu.utn.frgp.TPFinalBanco.service.impl.GestionClienteServiceImpl;

public class ListarCuentasAction extends BaseAction {

	private static final long serialVersionUID = 1L;

	private Cliente cliente;
	private String dni;
	private String contrasenia;

	@Override
	public String execute() throws Exception {

		GestionClienteServiceImpl clienteService = (GestionClienteServiceImpl) getContext()
				.getBean("gestionClientesService");
		cliente = clienteService.getCliente(dni);
		if(cliente != null && dni.equals(cliente.getDni()) && contrasenia.equals(contrasenia.trim())){
			return SUCCESS;
		}else{
			return ERROR;
		}
		
	}

	public Cliente getCliente() {
		return cliente;
	}

	public void setCliente(Cliente cliente) {
		this.cliente = cliente;
	}

	public String getDni() {
		return dni;
	}

	public void setDni(String dni) {
		this.dni = dni;
	}

	public String getContrasenia() {
		return contrasenia;
	}

	public void setContrasenia(String contrasenia) {
		this.contrasenia = contrasenia;
	}

		

}
